package com.xm.xmapp.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;

import com.amap.api.services.core.SuggestionCity;
import com.xm.xmapp.R;
import com.xm.xmapp.base.MyBaseAdapter;
import com.xm.xmapp.base.ViewHolder;
import com.xm.xmapp.customview.CustomLayout;
import com.xm.xmapp.myinterface.ListViewOnclickInterFace;

public class SuggestionCityAdapter extends MyBaseAdapter<SuggestionCity>{
	
	private ListViewOnclickInterFace in;
	

	public SuggestionCityAdapter(ArrayList<SuggestionCity> list,
			Activity activity, int layoutId) {
		super(list, activity, layoutId);
		// TODO Auto-generated constructor stub
	}
 
	public ListViewOnclickInterFace getIn() {
		return in;
	}

	public void setIn(ListViewOnclickInterFace in) {
		this.in = in;
	}

	@Override
	public void setValues(ViewHolder holder, final SuggestionCity t, int position) {
		// TODO Auto-generated method stub
		
		CustomLayout name = (CustomLayout) holder.getView(R.id.name);
		holder.getView(R.id.city).setVisibility(View.GONE);
		name.setText1(t.getCityName());
		name.setImg1Gone();
		name.setImg2Gone();
		
		holder.getConvertView().setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				if(in!=null)
				{
					in.DoSomeThing(t);
				}
			}
		});
	}
	


}
